<div class="wrapper col3">
    <div id="homecontent">
        <div class="fl_left"> 
            <div class="column2"><!-- start news block -->
                <!-- <h2>Последние новости!</h2> -->
                <?php
                    //Вывод последних новостей
                   
                        echo "<div id='news'>";

                        echo "<div id='post-title'><h3><a href='/post/read/".$post->id_post."' title='link'>".$post->title."</a></h3></div>";
                      if ($post->image!="") {
                        	 echo "<div class='post_image'><img class='imgl' src='/images/post/".$post->image."'  alt='news' /></div>"; 
                        }
                        else
                        { 
                        	echo "<div class='post_image'><img class='imgl' src='/images/news/imgl.gif'  alt='news' /></div>";  
                        }                          
                        echo '<div class="preview"><ul class="postmetadata"><li class="author">Автор <a href="#">'.$post->User->username.'</a></li>';
                        echo '<li>';
                        $this->widget('application.components.Date',array('dat'=>$post->date));
                        
                        echo '</li>';
                        
                         echo '<li>';
                            $this->widget('application.components.CountComent',array('type'=>"post",'id'=>$post->id_post));
                    	echo '</li></ul>';
                    
                        echo $post->text;
                        echo "</p></div></div>";

               ?>           
     
  			</div>
               <?php
               //Вывод коментариев
	               echo '<div id="comments">';
	               $this->widget('application.components.CommentsWiget',array('object'=>"post",'id_post'=>$post->id_post));
	               echo '</div>';
               ?>
             
	<div id="respond">
	
		<h2>Добавить комментарий</h2>
	    <?php echo CHtml::form(); ?>
			<p><?php         
				echo CHtml::hiddenField('object','post' );
				echo CHtml::hiddenField('id_post',$post->id_post );
				?>
			</p>
	
	<?php if (Yii::app()->user->isGuest) { ?>
		<p><?php  echo CHtml::textField('user_name','',$htmlOptions=array('size'=>22,'id'=>'name')); ?>
		<label for="name"><small>Name (required)</small></label></p>
		<?php  } else {?> <?php  echo CHtml::hiddenField('user_name',Yii::app()->user->username); ?>
		<?php }?>
	
	<p>
	<?php
	
	echo CHtml::textArea('comment','',$htmlOptions=array('rows'=>'10','cols'=>"88" ));
	echo '<label for="comment" style="display:none;"><small>Comment (required)</small></label>'
				            ?></p>
	<p><?php 
	
	echo CHtml::ajaxButton('Добавить комент', '/site/AddComent/', array(
				        'type' => 'POST',      
				        'update' => '#comments',
	),
	array(
				        'type' => 'submit',
				        'update'=>'#comments'
				        ));
	
				        echo CHtml::endForm();
				        ?></p>
				      
	
	</div>

</div>
        <div id="column">
           <div class="subnav">
             <h2>Категории статей</h2>
                <div id="sidebox">
                <ul class="tablets">
                <li>
                	<div id="imgholder">
						<!-- <a href="" title="img title"> -->
							<?php echo '<strong><a href="/post/1" title="link">Все</a></strong>'; ?>
						<!--  </a> -->
					</div>
				</li>
                <?php
                 foreach ($tags as $key) { ?>
        		<li>
                    <div id="imgholder">
						<!-- <a href="" title="img title"> -->
							<?php echo '<strong><a href="/post/'.$key->post_tag_name.'/1" title="link">'.$key->post_tag_name.'</a></strong>'; ?>
						<!--  </a> -->
					</div>
				</li>
               <?php   }?>
    
                
               </ul>
                </div>  
           
 
          </div>
            <?php $this->widget('application.components.IndexAdvertisement',array('index'=>false)); ?>
            <!-- Featured block in this widget -->
           
       </div>
         
    </div>
   
</div>

<!-- end preview 2 post's -->



    
     
    
     
      